package com.github.rxyor.common.core.enums;


import lombok.Getter;
import lombok.ToString;

/**
 *<p>
 *
 *</p>
 *
 * @author liuyang
 * @date 2019/10/8 周二 13:39:00
 * @since 1.0.0
 */
@ToString
public enum CoreExCodeEnum implements KeyValue<Integer> {

    //核心异常编码
    SUCCESS(200, "请求成功"),
    ILLEGAL_PARAM(400, "非法参数"),
    AUTHENTICATION_FAIL(401, "用户身份鉴定失败"),

    FAIL(500, "请求失败, 请稍后尝试"),

    RPC_FAIL(502, "请求依赖服务失败, 请稍后尝试"),

    DATA_ERROR(540, "数据错误"),

    MYSQL_FAIL(550, "数据库操作失败"),
    MYSQL_UNEXPECTED_AFFECT_ROWS(553, "数据库影响行数不符合预期结果"),

    MQ_FAIL(570, "处理MQ消息失败"),

    REDIS_FAIL(590, "Redis异常"),
    REDIS_LOCK_FAIL(591, "分布式锁异常"),

    //通用业务异常
    BIZ_FAIL(5000, "业务异常, 请稍后尝试"),
    ;

    @Getter
    private Integer code;

    @Getter
    private String desc;

    CoreExCodeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
